package com.atkxp.dao;

import com.atkxp.pojo.Blog;
import com.atkxp.pojo.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author user
 * @declaration
 * @create 2022/11/6-19:14
 */
@Repository
public interface BlogMapper {
    List<Blog> getAllBlog();

    List<Blog> getAllBlogOrderByTime();

    List<Blog> getTopSevenBlogOrderByLikes();

    List<Blog> getTopSevenBlogOrderByBrowsesNum();

    List<Blog> getBlogsLimit(@Param("begin") int begin, @Param("pageSize") int pageSize);

    Blog getBlogById(int id);

    List<Blog> getBlogByUserId(Map map);

    List<Blog> getBlogByUserIdOrderByTime(Map map);

    int addBlog(Blog blog);

    int updateBlog(Blog blog);

    int deleteBlogById(int id);

    List<Blog> queryBlog(Map map);

    int addLikes(int id);

    int addBrowsesNum(int id);

    int deleteLikes(int id);

    Long getBlogCount();

    Long getBlogCountLimitByUserId(int userId);

    Long getBlogCountLimitByBlogName(String blogName);

    List<Blog> getBlogByTag(Map map);

    Long getBlogCountLimitByTag(String Tag);

    List<Blog> FindSimilarBlogByTag(Blog blog);

    List<Integer> getHistoryBlogOrderByTime(int userId);

    int addHistoryBlog(Map historyBlog);

    int deleteHistoryBlog(@Param("userId") int userId, @Param("blogId") int blogId);

    Long isExistHistoryBlog(@Param("userId") int userId, @Param("blogId") int blogId);

    int updateHistoryBlog(Map newHistoryBlog);

    Long getHistoryBlogCount(int userId);

    Date getHistoryBlogDate(@Param("userId") int userId, @Param("blogId") int blogId);

    List<Integer> getCollectedBlogOrderByTime(int userId);

    int collectBlog(Map map);

    int deleteCollectedBlog(@Param("userId") int userId, @Param("blogId") int blogId);

    Long getCollectedBlogCount(int userId);

    Long isCollected(@Param("userId") int userId, @Param("blogId") int blogId);

    int getNumOfCollections(int blogId);

}
